import request from '@/utils/request'
/**
 * 分页信息列表
 * @param pageNum
 * @param pageSize
 */
const getList = function(pageNum, pageSize, message) {
  return request({
    url: '/receipt/list?pageNum='+pageNum+'&pageSize='+pageSize+'&message='+message,
    method: 'post',
    // data: params != null ? params : {}
  })
}

const getOrderList = function(pageNum, pageSize, params) {
  return request({
    url: '/sysOrder/list?pageNum='+pageNum+'&pageSize='+pageSize,
    method: 'post',
    data: params != null ? params : {}
  })
}

const getRouthList = function(orderNo,orderType,  params) {
  return request({
    url: '/rout/list?orderNo='+orderNo+'&orderType='+orderType,
    method: 'get',
    data: params != null ? params : {}
  })
}

/**
 * 更新订单
 * @param data
 */
const update = function(data) {
  return request({
    url: '/receipt/update',
    method: 'post',
    data: data
  })
}

const saveRectipt = function(data) {
  return request({
    url: '/receipt/save',
    method: 'post',
    data: data
  })
}

const saveRout = function(data) {
  return request({
    url: '/rout/save',
    method: 'post',
    data: data
  })
}
const del= function(id) {
  return request({
    url: '/receipt/delete/'+id,
    method: 'get',
    // data: data
  })
}

/**
 * 更新路由
 * @param data
 */
const updateRout = function(data) {
  return request({
    url: '/rout/update',
    method: 'put',
    data: data
  })
}

const test = function() {
  return request({
    url: '/receipt/test',
    method: 'get',
    // data: data
  })
}

export const rectiptApi = {
  getList: getList,
  update:update,
  saveRectipt:saveRectipt,
  getOrderList:getOrderList,
  getRouthList:getRouthList,
  del:del,
  updateRout:updateRout,
  test:test,
  saveRout:saveRout
}
